﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace PracaInz_v0
{
    class TreeViewSettings : INotifyPropertyChanged
    {
        /// <summary>
        /// zawiera ustawienia widoku drzewa
        /// </summary>

        //ustawienia
        int _treeViewLevel = 5;        
        bool _showClusters = false;
        bool _showLogicRules = false;
        bool _showNodeVectors = false;
        double _sliderValue = 1;

        //metody
        bool _rbMinVar = true;
        bool _rbMLP = false;
        bool _rbMinVar2a = false;

        //widoki
        DataView _dataView = null;
        DataView _dataGridTree = null;
        DataView _dataGridS = null;
        Canvas _treeView = null;

        //info wezla
        string _globalNodeNum = "";
        string _nodeLevel = "";
        string _nodeNum = "";
        string _regresionFormula = "";

        //info wyswietlanego drzewa
        string _selectedTreeView = "";
        string _selectedTreeData = "";
        string _selectedTreeQuality = "";

        public string SelectedTreeQuality
        {
            get { return this._selectedTreeQuality; }
            set
            {
                this._selectedTreeQuality = value;
                OnPropertyChanged("SelectedTreeQuality");
            }
        }

        public string SelectedTreeView
        {
            get { return this._selectedTreeView; }
            set
            {
                this._selectedTreeView = value;
                OnPropertyChanged("SelectedTreeView");
            }
        }

        public string SelectedTreeData
        {
            get { return this._selectedTreeData; }
            set
            {
                this._selectedTreeData = value;
                OnPropertyChanged("SelectedTreeData");
            }
        }

        public string RegresionFormula
        {
            get { return this._regresionFormula; }
            set
            {
                if (_regresionFormula != value)
                {
                    this._regresionFormula = value;
                    OnPropertyChanged("RegresionFormula");
                }
            }
        }

        public Canvas TreeView
        {
            get { return this._treeView; }
            set
            {
                if (_treeView != value)
                {
                    SliderValue = 1;
                    this._treeView = value;
                    OnPropertyChanged("TreeView");
                }
            }
        }

        public string GlobalNodeNum
        {
            get { return this._globalNodeNum; }
            set
            {
                this._globalNodeNum = value;
                OnPropertyChanged("GlobalNodeNum");
            }
        }

        public string NodeLevel
        {
            get { return this._nodeLevel; }
            set
            {
                this._nodeLevel = value;
                OnPropertyChanged("NodeLevel");
            }
        }

        public string NodeNum
        {
            get { return this._nodeNum; }
            set
            {
                this._nodeNum = value;
                OnPropertyChanged("NodeNum");
            }
        }
        
        public bool RbMinVar
        {
            get { return this._rbMinVar; }
            set
            {
                this._rbMinVar = value;
                OnPropertyChanged("RbMinVar");
            }
        }

        public bool RbMLP
        {
            get { return this._rbMLP; }
            set
            {
                this._rbMLP = value;
                OnPropertyChanged("RbMLP");
            }
        }

        public bool RbMinVar2a
        {
            get { return this._rbMinVar2a; }
            set
            {
                this._rbMinVar2a = value;
                OnPropertyChanged("RbMinVar2a");
            }
        }

        public DataView DataViewGridTree
        {
            get { return this._dataGridTree; }
            set
            {
                if (_dataGridTree != value)
                {
                    this._dataGridTree = value;
                    OnPropertyChanged("DataViewGridTree");
                }
            }
        }

        public DataView DataViewGridS
        {
            get { return this._dataGridS; }
            set
            {
                if (_dataGridS != value)
                {
                    this._dataGridS = value;
                    OnPropertyChanged("DataViewGridS");
                }
            }
        }

        public double SliderValue
        {
            get { return this._sliderValue; }
            set
            {
                this._sliderValue = value;
                OnPropertyChanged("SliderValue");
            }
        }

        public DataView DataView
        {
            get { return this._dataView; }
            set
            {
                if (_dataView != value)
                {
                    this._dataView = value;
                    OnPropertyChanged("DataView");
                    BottomBarInfo.Instance.DataViewRowsCount = value.Count;
                }
            }
        }

        public int TreeViewLevel
        { 
            get { return this._treeViewLevel; }
            set 
            {
                this._treeViewLevel = value;
                OnPropertyChanged("TreeViewLevel");
            }
        }

        public bool ShowClusters
        {
            get { return this._showClusters; }
            set
            {
                this._showClusters = value;
                OnPropertyChanged("ShowClusters");
            }
        }

        public bool ShowLogicRules
        {
            get { return this._showLogicRules; }
            set
            {
                this._showLogicRules = value;
                OnPropertyChanged("ShowLogicRules");
            }
        }

        public bool ShowNodeVectors 
        {
            get { return this._showNodeVectors; }
            set
            {
                this._showNodeVectors = value;
                OnPropertyChanged("ShowNodeVectors");
            }
        }       

        public event PropertyChangedEventHandler PropertyChanged = null;

        virtual protected void OnPropertyChanged(string propName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }
    }
}
